home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / fpc / source / docs / refex / ex23.pp < prev    next >
Encoding:
Text File  |  2000-01-01  |  581 b   |  31 lines

  1. Program Example23;
  2.  
  3. { Program to demonstrate the FilePos function. }
  4.  
  5. Var F : File of Longint;
  6.     L,FP : longint;
  7.     
  8. begin
  9.   { Fill a file with data : 
  10.     Each position contains the position ! }
  11.   Assign (F,'test.dat');
  12.   Rewrite (F);
  13.   For L:=0 to 100 do
  14.     begin
  15.     FP:=FilePos(F);
  16.     Write (F,FP);
  17.     end;
  18.   Close (F);
  19.   Reset (F);
  20.   { If all goes well, nothing is displayed here. }
  21.   While not (Eof(F)) do
  22.     begin
  23.     FP:=FilePos (F);
  24.     Read (F,L);
  25.     if L<>FP then 
  26.       Writeln ('Something wrong: Got ',l,' on pos ',FP);
  27.     end;
  28.   Close (F);
  29.   Erase (f);
  30. end.
  31.